package com.ruoyi.huoxingshi.service.impl;

import java.util.List;
import com.ruoyi.common.utils.DateUtils;
import com.ruoyi.common.utils.SecurityUtils;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import com.ruoyi.huoxingshi.mapper.HxsCategoriesMapper;
import com.ruoyi.huoxingshi.domain.HxsCategories;
import com.ruoyi.huoxingshi.service.IHxsCategoriesService;

/**
 * 分类Service业务层处理
 * 
 * @author huoxingshi
 * @date 2025-06-25
 */
@Service
public class HxsCategoriesServiceImpl implements IHxsCategoriesService 
{
    @Autowired
    private HxsCategoriesMapper hxsCategoriesMapper;

    /**
     * 查询分类
     * 
     * @param id 分类主键
     * @return 分类
     */
    @Override
    public HxsCategories selectHxsCategoriesById(Long id)
    {
        return hxsCategoriesMapper.selectHxsCategoriesById(id);
    }

    /**
     * 查询分类列表
     * 
     * @param hxsCategories 分类
     * @return 分类
     */
    @Override
    public List<HxsCategories> selectHxsCategoriesList(HxsCategories hxsCategories)
    {
        return hxsCategoriesMapper.selectHxsCategoriesList(hxsCategories);
    }

    /**
     * 新增分类
     * 
     * @param hxsCategories 分类
     * @return 结果
     */
    @Override
    public int insertHxsCategories(HxsCategories hxsCategories)
    {
        hxsCategories.setCreateTime(DateUtils.getNowDate());
        hxsCategories.setCreateBy(SecurityUtils.getUsername());
        return hxsCategoriesMapper.insertHxsCategories(hxsCategories);
    }

    /**
     * 修改分类
     * 
     * @param hxsCategories 分类
     * @return 结果
     */
    @Override
    public int updateHxsCategories(HxsCategories hxsCategories)
    {
        hxsCategories.setUpdateTime(DateUtils.getNowDate());
        hxsCategories.setUpdateBy(SecurityUtils.getUsername());
        return hxsCategoriesMapper.updateHxsCategories(hxsCategories);
    }

    /**
     * 批量删除分类
     * 
     * @param ids 需要删除的分类主键
     * @return 结果
     */
    @Override
    public int deleteHxsCategoriesByIds(Long[] ids)
    {
        return hxsCategoriesMapper.deleteHxsCategoriesByIds(ids);
    }

    /**
     * 删除分类信息
     * 
     * @param id 分类主键
     * @return 结果
     */
    @Override
    public int deleteHxsCategoriesById(Long id)
    {
        return hxsCategoriesMapper.deleteHxsCategoriesById(id);
    }
}
